home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / Source Code / Cstm3Dlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-12  |  2.7 KB  |  113 lines

  1. // cstm3dlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "DxAppWiz.h"
  6. #include "cstm3dlg.h"
  7. #include "DXaw.h"
  8.  
  9. #ifdef _PSEUDO_DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CCustom3Dlg dialog
  16.  
  17.  
  18. CCustom3Dlg::CCustom3Dlg( CDialogChooser* pChooser )
  19.     : CAppWizStepDlg(CCustom3Dlg::IDD)
  20. {
  21.     m_pChooser = pChooser;
  22.     m_pChooser->m_pDlg3Preview = &m_Preview;
  23.  
  24.     m_bDlgInited    = FALSE;
  25.  
  26.     m_bActionmapper = TRUE;
  27.     m_bKeyboard     = FALSE;
  28.  
  29.     //{{AFX_DATA_INIT(CCustom3Dlg)
  30.         // NOTE: the ClassWizard will add member initialization here
  31.     //}}AFX_DATA_INIT
  32. }
  33.  
  34.  
  35. void CCustom3Dlg::DoDataExchange(CDataExchange* pDX)
  36. {
  37.     CAppWizStepDlg::DoDataExchange(pDX);
  38.     //{{AFX_DATA_MAP(CCustom3Dlg)
  39.     DDX_Control(pDX, IDC_BACKGROUND, m_Background);
  40.     DDX_Control(pDX, IDC_PREVIEW, m_Preview);
  41.     //}}AFX_DATA_MAP
  42. }
  43.  
  44. // This is called whenever the user presses Next, Back, or Finish with this step
  45. //  present.  Do all validation & data exchange from the dialog in this function.
  46. BOOL CCustom3Dlg::OnDismiss()
  47. {
  48.     if( m_bDlgInited )
  49.         UpdateData(TRUE);
  50.  
  51.     if( m_bKeyboard )
  52.         DirectXaw.m_Dictionary["KEYBOARD"]="Yes";
  53.     else
  54.         DirectXaw.m_Dictionary.RemoveKey("KEYBOARD");
  55.  
  56.     if( m_bActionmapper )
  57.         DirectXaw.m_Dictionary["ACTIONMAPPER"]="Yes";
  58.     else
  59.         DirectXaw.m_Dictionary.RemoveKey("ACTIONMAPPER");
  60.  
  61.     return TRUE;    // return FALSE if the dialog shouldn't be dismissed
  62. }
  63.  
  64.  
  65. void CCustom3Dlg::RemoveAllKeys()
  66. {
  67.     DirectXaw.m_Dictionary.RemoveKey("KEYBOARD");
  68.     DirectXaw.m_Dictionary.RemoveKey("ACTIONMAPPER");
  69. }
  70.  
  71. BEGIN_MESSAGE_MAP(CCustom3Dlg, CAppWizStepDlg)
  72.     //{{AFX_MSG_MAP(CCustom3Dlg)
  73.     ON_BN_CLICKED(IDC_KEYBOARD, OnKeyboard)
  74.     ON_BN_CLICKED(IDC_ACTIONMAPPER, OnActionmapper)
  75.     //}}AFX_MSG_MAP
  76. END_MESSAGE_MAP()
  77.  
  78.  
  79. void CCustom3Dlg::UpdateInfo()
  80. {
  81.     UpdateData(TRUE);
  82.  
  83.     m_bActionmapper = IsDlgButtonChecked( IDC_ACTIONMAPPER );
  84.     m_bKeyboard     = IsDlgButtonChecked( IDC_KEYBOARD );
  85. }
  86.  
  87.  
  88. void CCustom3Dlg::OnKeyboard() 
  89. {
  90.     UpdateInfo();
  91. }
  92.  
  93. void CCustom3Dlg::OnActionmapper() 
  94. {
  95.     UpdateInfo();
  96. }
  97.  
  98. BOOL CCustom3Dlg::OnInitDialog() 
  99. {
  100.     CAppWizStepDlg::OnInitDialog();
  101.     
  102.     m_bDlgInited = TRUE;    
  103.     
  104.     CheckDlgButton( IDC_ACTIONMAPPER, (m_bActionmapper) ? BST_CHECKED : BST_UNCHECKED  );
  105.     CheckDlgButton( IDC_KEYBOARD, (m_bKeyboard) ? BST_CHECKED : BST_UNCHECKED  );
  106.     
  107.     m_Background.SetBitmap( m_pChooser->m_hBackgroundBitmap );
  108.     m_pChooser->UpdatePreviewAndSteps( &m_Preview );
  109.  
  110.     return TRUE;  // return TRUE unless you set the focus to a control
  111.                   // EXCEPTION: OCX Property Pages should return FALSE
  112. }
  113.